/**
 * 
 * @author Sunix
 * @date   2013-5-19
 * @Email  SunixSky@gmail.com
 * 
 */	
package manager{
	import br.com.stimuli.loading.BulkProgressEvent;
	
	
	public class ConfigManager{
		
		public static var init:Boolean;
		
		public function ConfigManager(){
			
		}
		
		public static function loadGeneralConfig():void{
			LoadManager.loader.add("assets/config/config.xml",{id:"config"});
			LoadManager.loader.addEventListener(BulkProgressEvent.COMPLETE,onGeneralComplete);
			LoadManager.loader.start();
		}
		
		public static function loadCategoryConfig():void{
			LoadManager.loader.add("assets/config/category.xml",{id:"category"});
			LoadManager.loader.addEventListener(BulkProgressEvent.COMPLETE,onComplete);
			LoadManager.loader.start();
		}
		
		protected static function onComplete(event:BulkProgressEvent):void{
			var xml:XML = LoadManager.loader.getXML("category",true);
			CategoryManager.readCategoryXML(xml);
		}
		
		protected static function onGeneralComplete(event:BulkProgressEvent):void{
			var xml:XML = LoadManager.loader.getXML("config",true);
			init= Boolean(uint(xml.@init));
		}
	}
}